package com.file.upload.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * @Description
 * @Author lhj
 * @Date 2025/4/23 21:30
 */
@Configuration
public class FileUploadConfig {

    @Bean
    public MultipartResolver multipartResolver() {
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
        resolver.setMaxUploadSize(1024 * 1024 * 1024); // 1GB
        resolver.setMaxUploadSizePerFile(50 * 1024 * 1024); // 50MB per chunk
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }
}